<?php
    require('./Utils.php');

    $type = $_GET['type'];

    $sql = "SELECT t.type type, k.kind kind,p.id id, name, intro, price, p.image, stock
            FROM  pet p LEFT JOIN pet_type t
            ON p.type_id = t.id LEFT JOIN pet_kind k
            ON p.kind_id = k.id
            WHERE t.type = ?";

    $conn = getConnection();
    
    $data = query_list($conn, $sql, $type);

    getJson(200, '获取成功', $data);
?>